﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StockCommon.sidehelper
{
    public class UnCategoriedStockManager
    {
        public static StockDataClassesDataContext getContext()
        {
            return LinqAgent.getContext();
        }

        public static void AddUnCategoriedStock(String stockCode,String stockName,String market,String catName,Guid catId)
        {
            StockDataClassesDataContext context = getContext();
            UnCategoriedStock u=(from us in context.UnCategoriedStocks where us.stockCode == stockCode select us).FirstOrDefault<UnCategoriedStock>();
            if (u != null)
                return;

            u = new UnCategoriedStock();
            u.stockCode = stockCode;
            u.stockName = stockName;
            u.catName = catName;
            u.catId = catId;
            u.market = market;
            context.UnCategoriedStocks.InsertOnSubmit(u);
            context.SubmitChanges();
        }

    }
}
